using TheBlog.NhibernateModel.Entities;

namespace TheBlog.NhibernateModel.Mappings
{
    public class ArticleMap : EntityMap<Article>
    {
        public ArticleMap()
        {
            Map(x => x.Title).Not.Nullable();
            Map(x => x.Content).Not.Nullable().Length(10000);
            HasMany(x => x.Comments)
                .KeyColumn("ArticleId").ForeignKeyConstraintName("FK_Article_CommentAffect_ArticleId")
                .AsBag().Cascade.AllDeleteOrphan();
        }
    }
}